var app = getApp();
var devicename1;
var devicesn;
Page({
  data:{
    devicename:app.globalData.deviceName,
    sn:'',
    sessionid:wx.getStorageSync('sessionid')
   
  },
  onLoad: function (options) {
    console.log("index1:    ",options, app.globalData.SN)
    devicename1=options.devicename
    devicesn=options.devicesn
    wx.setStorageSync('devicename1', options.name)
    wx.setStorageSync('options', options)
    console.log("index2:    ",wx.getStorageSync('options'))
    console.log(options,"------sessionid-----",wx.getStorageSync('sessionid'))
    // if(options.sessionid!=wx.getStorageSync('sessionid')||options.devicesn!=app.globalData.SN){
    //   console.log("--------------------exit")
    //   wx.navigateTo({
    //     url: '/pages/devicelist/devicelist',
    //   })
    // }
   
    // Do some initialize when page load.
  },
  onReady: function () {
    this.setData({
      devicename:devicename1,
      sn:devicesn
    })
    // Do something when page ready.
    //  var options=wx.getStorageSync('options')
    //  if(options.sessionid!=wx.getStorageSync('sessionid')||options.devicesn!=app.globalData.SN){
    //   console.log("--------------------exit")
    //   wx.navigateBack({
    //     delta: 1, // 回退前 delta(默认为1) 页面
    //   })
      // wx.navigateTo({
      //   url: '/pages/devicelist/devicelist',
      // })
   // }
  },
  onShow: function () {
    // Do something when page show.
  },
  onHide: function () {
    // Do something when page hide.
  },
  onUnload: function () {
    // Do something when page close.
  },
  // Event handler.
  viewTap: function () {
    this.setData({
      text: 'Set some data for updating view.'
    })
  },
 
})


